﻿using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Domain.Entities.Auditing;
using YunDrug.Employees;

namespace YunDrug.EmployeeAuthorization
{
    /// <summary>
    /// 角色信息
    /// </summary>
   public  class Role:AuditedAggregateRoot<Guid>
    {
        public int Sort { get; set; }
        /// <summary>
        /// 角色名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 角色描述
        /// </summary>
        public string Describe { get; set; }

        /// <summary>
        /// 该角色下的员工
        /// </summary>
        public virtual List<EmployeeRole> EmployeeRoles { get; protected set; }
        /// <summary>
        /// 该角色拥有的列权限
        /// </summary>
        public virtual List<RoleColumnPermissions> RoleColumnPermissions { get; protected set; }
        /// <summary>
        /// 该角色拥有的菜单权限
        /// </summary>
        public virtual List<RolePageElement> RolePageElements { get;protected set; }

        public void AddEmployee(Guid employeeid)
        {
            EmployeeRoles.Add(new EmployeeRole(employeeid, this.Id));
        }

        public void AddRolePageElement(Guid)
        {

        }
        //public List<UserRole> GetRoleUsers()
        //{
            
        //    return UserRole;
        //}

        //public void AddUser(Guid userId)
        //{
        //    if (UserRole == null)
        //    {
        //        UserRole = new List<UserRole>();
        //    }
        //    UserRole.Add(new Roles.UserRole(userId, this.Id));
        //}

        //public void RemoveUser(Guid userId)
        //{
        //    if (UserRole != null)
        //    {
        //        UserRole.RemoveAll(p => p.UserId.Equals(userId));
        //    }
        //}
    }
}
